import request from '@/utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};

export default {
    addCommodity(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/addAllCommodity',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    getAllAttributes() {
        const req = request({
            method: 'post',
            url: '/commodity/getAllAttributes',
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    getAllCommodityTypes() {
        const req = request({
            method: 'post',
            url: '/commodity/getAllCommodityTypes',
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    addCommodityType(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/addCommodityType',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    deleteCommodityType(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/deleteCommodityType',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    updateCommodityType(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/updateCommodityType',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    getCommodities(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/MGetCommodities',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    getOrders(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/MGetOrders',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    },
    changeOrderToComplate(formData) {
        const req = request({
            method: 'post',
            url: '/commodity/MChangeOrderToComplate',
            data: formData,
            headers: {
                'Content-Type': "multipart/form-data"
            }
        })
        return req
    }
    // fetchData(query) {
    //     return request({
    //         url: './table.json',
    //         method: 'get',
    //         params: query
    //     });
    // }
}
